﻿using UnityEngine;
namespace HBFramework
{
    public class HotUpdate
    {
        public static void Start()
        {
            //初始化基础单例
            SingletonManager.Instance.CreateSingleton<SSceneManager>();
            SingletonManager.Instance.CreateSingleton<StorageManager>();
            SingletonManager.Instance.CreateSingleton<PanelManager>();
            SingletonManager.Instance.CreateSingleton<TimerManager>();
            SingletonManager.Instance.CreateSingleton<TimeManager>();
            SingletonManager.Instance.CreateSingleton<AudioManager>();
#if UNITY_WECHAT_GAME
            SingletonManager.Instance.CreateSingleton<WxMiniGameManager>();
#endif
            //控制GM
            if (ProjectConfig.Config.openGM)
                GameManagerProxy.Instance.OpenGM(OnGMBtnClick);

            Application.targetFrameRate = ProjectConfig.Config.targetFrameRate;
            PanelManager.Instance.resolution = ProjectConfig.Config.resolution;
            GameEntrance.StartGame();
        }

        private static async void OnGMBtnClick()
        {
            await PanelManager.Instance.OpenPanel<Panel_GM>();
        }
    }
}
